<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>任务组管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function groupForm(groupId,projectId){
			var url = "${ctx}/pro/taskGroup/form?project.id="+projectId+"&id="+groupId;
			top.$.jBox.open("iframe:"+url, "任务组详情",810,$(top.document).height()-120,{
                buttons:{"提交":"ok", "关闭":true}, bottomText:"任务组详情",submit:function(v, h, f){
                    var code;
                    if (v=="ok"){
                    	// 执行保存
                        //loading('正在提交，请稍等...');
                    	var flag = h.find("iframe")[0].contentWindow.submitForm();
                    	if(flag){
                    		location.reload();
                    	}
                        return false;
                    }
                }, loaded:function(h){
                    $(".jbox-content", top.document).css("overflow-y","hidden");
                }
            });
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a id="btn" href="${ctx}/pro/taskGroup/list?project.id=${e.project.id}">任务组列表</a></li>
		<shiro:hasPermission name="pro:taskGroup:create"><li><a href="javascript:void(0);" onclick="groupForm('','${e.project.id}');">任务组添加</a></li></shiro:hasPermission>
		<shiro:hasPermission name="pro:proLog:view">
			<li><a href="${ctx}/pro/proLog/list?project.id=${e.project.id}">项目日志</a>
			</li>
         </shiro:hasPermission>
         <li><a href="${ctx}/pro/project/ganttViewData?id=${e.project.id}">项目进度</a></li>
         <shiro:hasPermission name="pro:taskGroup:import">
			<li><a href="${ctx}/pro/taskGroup/previewList?project.id=${e.project.id}">任务导入</a>
			</li>
         </shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="taskGroup" action="${ctx}/pro/taskGroup/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input id="projectId" name="project.id" type="hidden" value="${e.project.id}"/>
		<a href="${ctx}/pro/project/">项目&gt;&gt;</a>
		<ul class="ul-form">
			<li><label>任务组名称：</label>
				<form:input path="name" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li><label>任务组状态：</label>
				<form:select path="delFlag" class="input-medium">
   					<form:option value="0" label="进行中"/>
   					<form:option value="1" label="已归档"/>
   				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>任务组名称</th>
				<th>任务数量</th>
				<th>未完成</th>
				<th>更新时间</th>
				<shiro:hasAnyPermissions name="pro:taskGroup:edit,pro:taskGroup:delete"><th>操作</th></shiro:hasAnyPermissions>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="taskGroup">
			<tr>
				<td><a href="${ctx}/pro/projectTask/list?taskGroup.id=${taskGroup.id}">
					${taskGroup.name}
				</a></td>
				<td>
					${taskGroup.taskQuantity}
				</td>
				<td>
					${taskGroup.stillQuantity}
				</td>
				<td>
					<fmt:formatDate value="${taskGroup.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<shiro:hasAnyPermissions name="pro:taskGroup:edit"><td>
					<c:if test="${taskGroup.delFlag == 0}">
						<shiro:hasPermission name="pro:taskGroup:edit">
		    				<a href="javascript:void(0);" onclick="groupForm('${taskGroup.id}','${taskGroup.project.id}');">修改</a>
						</shiro:hasPermission>
						<shiro:hasPermission name="pro:taskGroup:delete">
							<a href="${ctx}/pro/taskGroup/delete?id=${taskGroup.id}" onclick="return confirmx('确认要归档该任务组吗？', this.href)">归档</a>
						</shiro:hasPermission>
					</c:if>
				</td></shiro:hasAnyPermissions>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>